package lab02.Test06;

/**
 * Created by Administrator on 2017/10/15.
 */
public class Circle {
    //属性：半径，周长，面积
    double radius,perimeter,area;
    public Circle(double r) {
        radius = r;
    }
    double area(){
        return 3.1415926*radius*radius;
    }
    double perimeter() {
    return 2*3.1415926*radius;
    }
    //行为:周长，面积
    void setRadius(double newRadius){
        radius=newRadius;
    }
    double getRadius(){
        return radius;
    }

    public static void main(String[] args) {
        Circle area1=new Circle(4);
        System.out.println("面积是"+area1.area());
        Circle perimeter1=new Circle(4);
        System.out.println("周长是"+perimeter1.perimeter());
    }
}
